import { ResPage, ReqPage } from '@/api/interface'
import { TBY } from '@/api/config/servicePort'
import http from '@/api'

/**解放碑 */
export namespace EducationRoom {
  export interface Query extends ReqPage {
    name?: string
  }

  export interface Record {
    /**主键id */
    id: number
    /**名称*/
    name: string
    /**面积 */
    area: number
    /**图片数量 */
    imageCount: number
    /**视频数量 */
    videoCount: number
    /**经度*/
    longitude: string
    /**维度*/
    latitude: number
  }

  export interface Form {
    /**主键id */
    id: number
    /**名称*/
    name: string
    /**面积 */
    area: number
    /**经度*/
    longitude: string
    /**维度*/
    latitude: number
    /**简介 */
    content: string
  }
}

export const pageEducationRoom = (params: EducationRoom.Query) => {
  return http.get<ResPage<EducationRoom.Record>>(TBY + `/education_room/page`, params)
}

// 详情
export const getEducationRoomDetail = (id: number) => {
  return http.get<Partial<EducationRoom.Form>>(TBY + `/education_room/get`, { id }, { loading: false })
}

// 新增或修改
export const saveOrUpdateEducationRoom = (params: Partial<EducationRoom.Form>) => {
  return http.post(TBY + `/education_room/save`, params)
}

// 删除
export const removeEducationRoom = (id: number) => {
  return http.delete(TBY + `/education_room/delete`, { id })
}

// 列表
export const listEducationRoom = (params: EducationRoom.Query) => {
  return http.get<EducationRoom.Record[]>(TBY + `/education_room/list`, params)
}
